<template>
  <div class="wrap">
    <el-input v-model="input" placeholder="请输入站点名称" />
    <el-button v-waves type="primary" @click="search">
      搜索
    </el-button>
  </div>
</template>

<script>
import waves from '@/directive/waves/index.js' // 水波纹指令
export default {
  directives: {
    waves
  },
  data() {
    return {
      input: ''
    }
  },
  watch: {
    input(val) {
      val === '' && this.$emit('search', this.input)
    }
  },
  methods: {
    search() {
      this.input && this.$emit('search', this.input)
    }
  }
}
</script>

<style scoped lang="scss">
.el-input {
    width: 200px;
    margin-right: 20px;
}
.wrap {
    margin-bottom: 20px;
}
</style>
